#ifndef IMAGE_H
#define IMAGE_H
#include "Matrix.h"

class Image : public Matrix
{
public:

	struct Color
	{
		float r;
		float g;
		float b;
	};

	class Iterator
	{
	public:
		Iterator(Image& pImage);
		Iterator(Image& pImage, unsigned int x, unsigned int y);
		~Iterator(void);

		void nextPixel();
		void previousPixel();
		void nextPixel(int nbPixels);
		void previousPixel(int nbPixels);
		void nextLine();
		void previousLine();
		void nextLine(int nbLines);
		void previousLine(int nbLines);
		bool hasNextPixel() const;
		bool hasNextLine() const;
		bool hasPreviousPixel() const;
		bool hasPreviousLine() const;
		bool isvalid() const;
		bool isNextPixelOnNextLine() const;
		Color getPixel() const;
		void setPixel(const Color& color);

	private:

		Image& mImage;
		float* mCurrentPixelPtr;
	};
	Image(void);
	Image(unsigned int width,unsigned int height);
	Image(const Image& source);
	~Image(void);

	void setValue(unsigned int x, unsigned int y, const Color& value);
	Color getValue(unsigned int x,unsigned int y) const;
	void setHeight(unsigned int pHeight);
	void setDimensions(unsigned int w,unsigned int h);
	unsigned int getHeight() const;
	unsigned int getWidth() const;
	void transpose();
	void convolve();

};

inline Image::Iterator::Iterator(Image& pImage) : mImage(pImage)
{
	mCurrentPixelPtr = pImage.m;
}
inline Image::Iterator::Iterator(Image& pImage, unsigned int x, unsigned int y) : mImage(pImage)
{
}

inline void Image::Iterator::nextPixel()
{
	mCurrentPixelPtr++;
}
inline void Image::Iterator::previousPixel()
{
	mCurrentPixelPtr--;
}
inline void Image::Iterator::nextPixel(int nbPixels)
{
	mCurrentPixelPtr += nbPixels;
}
inline void Image::Iterator::previousPixel(int nbPixels)
{
}
inline void Image::Iterator::nextLine()
{
}
inline void Image::Iterator::previousLine()
{
}
inline void Image::Iterator::nextLine(int nbLines)
{
}
inline void Image::Iterator::previousLine(int nbLines)
{
}
inline bool Image::Iterator::hasNextPixel() const
{
	return false;
}
inline bool Image::Iterator::hasNextLine() const
{
	return false;
}
inline bool Image::Iterator::hasPreviousPixel() const
{
	return false;
}
inline bool Image::Iterator::hasPreviousLine() const
{
	return false;
}
inline bool Image::Iterator::isvalid() const
{
	return false;
}
inline bool Image::Iterator::isNextPixelOnNextLine() const
{
	return false;
}
inline Image::Color Image::Iterator::getPixel() const
{
	Image::Color c = {0.0, 0.0, 0.0};
	return c;
}
inline void Image::Iterator::setPixel(const Color& color)
{
}

#endif
